<template>
  <div>
    <el-tabs class="m-t-10" v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="基本信息" name="baseInfo">
        <basicinfo
          :customer="customer"
          :customerId="customerId"
          @back="back"
        ></basicinfo>
      </el-tab-pane>
      <el-tab-pane label="优惠券" name="coupon">
        <coupon :customerId="customerId" />
      </el-tab-pane>
      <el-tab-pane label="加注卡" name="fillcard">
        <fillcard :customerId="customerId"></fillcard>
      </el-tab-pane>
      <el-tab-pane label="余额流水" name="balancewater">
        <balancewater :customerId="customerId"></balancewater>
      </el-tab-pane>
      <el-tab-pane label="加注记录" name="fillhistory">
        <filling-record-normal-user-list
          :id="customer.id"
          @hide="showGeneralUserRecordFlag = false"
          :closeBtn="false"
        />
      </el-tab-pane>
    </el-tabs>

    <el-dialog
      title="加注记录"
      append-to-body
      :visible.sync="showGeneralUserRecordFlag"
      width="1000px"
    >
      <filling-record-normal-user-list
        :id="customer.id"
        v-if="showGeneralUserRecordFlag"
        @hide="showGeneralUserRecordFlag = false"
        :closeBtn="true"
      />
    </el-dialog>
  </div>
</template>

<script>
import basicinfo from "@/views/customer/compontents/basicinfo.vue";
import coupon from "@/views/customer/compontents/coupon.vue";
import fillcard from "@/views/customer/compontents/fillcard.vue";
import fillhistory from "@/views/customer/compontents/fillhistory.vue";
import balancewater from "@/views/customer/compontents/balancewater.vue";
import KeyValue from "@/components/basic-block/key-value";
import AppPagination from "@/components/business/app-pagination";
import FillingRecordNormalUserList from "@/views/customer/compontents/filling-record-normal-user-list.vue";

export default {
  name: "customer-detail-content",
  components: {
    FillingRecordNormalUserList,
    AppPagination,
    KeyValue,
    basicinfo,
    coupon,
    fillcard,
    fillhistory,
    balancewater,
  },
  props: {
    customer: {
      type: Object,
      default: () => {},
    },
  },
  data() {
    return {
      businessUserRecordsLoading: false,
      generalUserRecordsLoading: false,
      showBusinessUserRecordFlag: false,
      showGeneralUserRecordFlag: false,
      data: [],
      page: {
        total: 0,
      },
      activeName: "baseInfo",
      customerId: "1254", //接收传递过来的用户id
    };
  },
  methods: {
    handleClick(row) {
      if (this.activeName === "fillhistory") {
        this.showGeneralUserRecordFlag = true;
      }
    },
    back(list) {
      this.$emit("handleBack", list);
    },

    pageChange() {},
  },
};
</script>

<style scoped></style>
